package mybatis.service.impl;

import mybatis.dao.StudentDao;
import mybatis.domain.Student;
import mybatis.service.StudentService;

import java.util.List;

/**
 * @Author 肖地洋
 * @Date 2022/5/19 21:13
 */
public class StudentServiceImpl implements StudentService {

    //引用赋值
    private StudentDao studentDao;

    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    //使用set注入赋值
    public StudentServiceImpl(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Override
    public int addStudent(Student student) {
        int nums = studentDao.insertStudent(student);
        return nums;
    }

    @Override
    public List<Student> queryStudents() {
        List<Student> list = studentDao.selectStudents();
        return list;
    }


}
